<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Login V1.0</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf8">
<LINK href="css/admin.css" type="text/css" rel="stylesheet">
</HEAD>
<BODY onload=document.form1.name.focus();>
<?php
require("php/connection.php"); ?>
<?php 
$_SESSION["login"]=false;
if(isset($_POST["name"])&&isset($_POST["pass"])){
$name=$_POST["name"];
$password=$_POST["pass"];
	 $query = "SELECT * FROM user where username='$name' and password='$password'";
  	$result = mysql_query($query) or die("Query failed");
		if(mysql_num_rows($result)==1){
			$row = mysql_fetch_row($result);
			session_start();
			$_SESSION["user"]=$name;
			$_SESSION["user_id"]=$row[0];
			header ("Location:index.php") ;
			exit();
		}

 mysql_free_result($result);
}

if(count($_POST)>0){
print "<div style='color:#FF1F08; background-color:#000990; text-align:center; '>Invalide Name or password!</div>";
}
?>
	<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"
		bgColor=#002779 border=0>
		<TR>
			<TD align=middle>
				<TABLE cellSpacing=0 cellPadding=0 width=468 border=0>
					<TR>
						<TD><IMG height=23 src="images/login_1.jpg" width=468></TD>
					</TR>
					<TR>
						<TD><IMG height=147 src="images/login_2.jpg" width=468></TD>
					</TR>
				</TABLE>
				<TABLE cellSpacing=0 cellPadding=0 width=468 bgColor=#ffffff
					border=0>
					<TR>
						<TD width=16><IMG height=122 src="images/login_3.jpg"
							width=16></TD>
						<TD align=middle>
							<TABLE cellSpacing=0 cellPadding=0 width=230 border=0>
								<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
									<TR height=5>
										<TD width=5></TD>
										<TD width=56></TD>
										<TD></TD>
									</TR>
									<TR height=36>
										<TD></TD>
										<TD>用户名：</TD>
										<TD><INPUT
											style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid"
											maxLength=30 size=24 name="name"></TD>
									</TR>
									<TR height=36>
										<TD>&nbsp;</TD>
										<TD>密码:</TD>
										<TD><INPUT
											style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid"
											type=password maxLength=30 size=24 name="pass"></TD>
									</TR>
									<TR height=5>
										<TD colSpan=3></TD>
									</TR>
									<TR>
										<TD>&nbsp;</TD>
										<TD>&nbsp;</TD>
										<TD><INPUT type=image height=18 width=70
											src="images/bt_login.gif"></TD>
									</TR>
								</FORM>
							</TABLE>
						</TD>
						<TD width=16><IMG height=122 src="images/login_4.jpg"
							width=16></TD>
					</TR>
				</TABLE>
				<TABLE cellSpacing=0 cellPadding=0 width=468 border=0>
					<TR>
						<TD><IMG height=16 src="images/login_5.jpg" width=468></TD>
					</TR>
				</TABLE>
				<TABLE cellSpacing=0 cellPadding=0 width=468 border=0>
					<TR>
						<TD align=right><A href="http://www.mycodes.net/"
							target=_blank><IMG height=26 src="images/login_6.gif"
								width=165 border=0></A></TD>
					</TR>
				</TABLE>
			</TD>
		</TR>
	</TABLE>
</BODY>
</HTML>
